package com.hmall.controller;


import com.hmall.domain.dto.LoginFormDTO;
import com.hmall.domain.dto.RegisterDTO;
import com.hmall.domain.vo.UserLoginVO;
import com.hmall.service.IUserService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author HBQ
 * @since 2025-10-22
 */
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor

public class UserController {

    private final IUserService userService;

    @PostMapping("login")
    @ApiOperation("用户登录")
    public UserLoginVO login(@RequestBody LoginFormDTO loginFormDTO) {
        return userService.login(loginFormDTO);
    }

    @PostMapping("register")
    @ApiOperation("用户注册")
    public Boolean register(@RequestBody RegisterDTO registerDTO) {
        return userService.register(registerDTO);
    }

}
